package com.cxc.myweb.demo.model.dto;

import java.util.ArrayList;
import java.util.List;

public class User {
    private Integer id;

    private String name;

    private String password;

    private List<Log> logs=new ArrayList<Log>();
    
    private List<Role> roles = new ArrayList<Role>();
    
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password == null ? null : password.trim();
    }
    
    public String toString() {
    	String baseInfo="id:"+id + ", name:"+name+", password:"+password;
    	StringBuffer sb = new StringBuffer();
    	for ( Log log : logs ){
    		sb.append("\n    "+log.toString());
    	}
    	String logsInfo=" logs:" + sb.toString();
    	sb.setLength(0);
    	for ( Role role : roles ){
    		sb.append("\n    "+role.toString());
    	}
    	String rolesInfo=" roles:" + sb.toString();   	
    	return baseInfo+logsInfo+sb.toString(); 
    }
    
}